<template>
	<view class="">
		<city-select @cityClick="cityClick" :activeCity="activeCity" :hotCity="hotCity" :obtainCitys="obtainCitys" :isSearch="true" ref="citys"></city-select>
		<!-- loading 遮罩层 -->
		<loading v-if="loadflag"></loading>
		<navigation></navigation>
	</view>
</template>

<script>
import citySelect from '@/pageB/city-selectt/city-select.vue';
import loading from '@/components/loading/loading.vue';
import navigation from '@/components/navigation/navigation.vue';
export default {
	components: {
		citySelect,
		loading,
		navigation
	},
	data() {
		return {
			loadflag: true,
			activeCity: {
				// 'cityCode': '320100',
				// 'cityName': '定位中...',
			},
			//热门城市
			hotCity: [],
			obtainCitys: [],
			club_id: ''
		};
	},
	onLoad(options) {
		this.club_id = options.id;
	},
	mounted() {
		this.getmemberList();
		this.getmember();
	},
	methods: {
		getmemberList() {
			var _this = this;
			this.ajax('club/clubUser', {
				data: {
					club_id: this.club_id
				},
				success: function(res) {
					var list = res.msg.data;
					var newList = [];
					for (var attr in list) {
						newList = newList.concat(list[attr]);
					}
					var regimental = {};
					var admin = [];
					//  // console.log (_this)
					 // console.log (newList);
					newList.forEach(e => {
						e.cityName = e.MemberName;
						if( e.Avatar ) {
							e.Avatar = e.Avatar.replace("http:","https:")
						}
						if (e.ClubRole == 9) {
							regimental = e;
						} else if (e.ClubRole == 5) {
							admin = admin.concat(e);
						}
					});
					//  // console.log (regimental)
					//  // console.log (admin)
					_this.activeCity = regimental;
					_this.hotCity = admin;
					_this.obtainCitys = newList;
					_this.loadflag = false;
				}
			});
		},
		getmember() {
			this.ajax('club/clubSetting', {
				data: {
					club_id: '1'
				},
				success: res => {
					 // console.log (res);
				}
			});
		}
	}
};
</script>

<style lang="less" scoped></style>
<style>
page {
	background-color: #f2f2f2;
}
</style>
